package com.example.consumer;

import com.example.constant.Constants;
import com.example.entity.User;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
@RabbitListener(queues = Constants.MY_SMS_QUEUE_NAME)
public class SmsConsumer {

    @RabbitHandler
    public void consumerStr(String str){
        System.out.println("【短信消费者】消费消息: str = " + str);
    }

    @RabbitHandler
    public void consumerUser(User user){
        System.out.println("====【短信消费者消费User】====");
        System.out.println("用户名 = " + user.getUserName());
        System.out.println("车名 = " + user.getCar().getCarName());
    }
}
